<template>
	<view :style="{height:pageHeight}">
		<scroll-view style="height:100%;">
			<view :style="{height:pageHeight}" class="bodyPage">
				<web-view ref="web" v-if="isShow==1" :src="pagePath" @message="handleMessage" @onPostMessage="handlePostMessage"
					style="height:100%;margin-top:10rpx;" />
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// #ifdef H5 || MP
				pageHeight: '667px',
				// #endif
				// #ifdef APP-PLUS
				//pageHeight: app.globalData.windowHeight,
				pageHeight: '667px',
				// #endif
				footerStatus: true,
				pagePath: "",
				isShow: 1,
				navTitle: "会员系统"
			};
		},
		created() {},
		onReady() {
			let _this=this;
			uni.getSystemInfo({
				success(e) {
					_this.pageHeight = e.windowHeight;
				}
			});
		},
		onLoad(options) {
			//pageHeight
			this.navTitle = options.title;
			this.pagePath = options.path+"?title="+this.navTitle;
			if(options.activeTabs){
				this.pagePath=this.pagePath+"&activeTabs="+options.activeTabs
			}
			this.pagePath = this.pagePath+"&token="+uni.getStorageSync('JWT-token')+"&userInfo="+JSON.stringify(uni.getStorageSync('userInfo'));
			// #ifdef APP-PLUS
			this.isShow = 2;
			var wv = plus.webview.create(this.pagePath, "custom-webview", {
				plusrequire: "none", //禁止远程网页使用plus的API，有些使用mui制作的网页可能会监听plus.key，造成关闭页面混乱，可以通过这种方式禁止
				'uni-app': 'none', //不加载uni-app渲染层框架，避免样式冲突
				top: uni.getSystemInfoSync().statusBarHeight +
				0, //放置在titleNView下方。如果还想在webview上方加个地址栏的什么的，可以继续降低TOP值
				height: uni.getSystemInfoSync().screenHeight - uni.getSystemInfoSync().statusBarHeight -0
			})
			var currentWebview = this.$scope
				.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效，非v3编译模式使用this.$mp.page.$getAppWebview()
			console.log(currentWebview);
			currentWebview.append(wv); //一定要append到当前的页面里！！！才能跟随当前页面一起做动画，一起关闭
			// #endif
		},
		mounted() {
			uni.setNavigationBarTitle({
				title: this.navTitle
			});
			
		},
		methods: {
			handlePostMessage(data) {
				console.log("handlePostMessage====");
				console.log(data);
			},
			handleMessage(data) {
				console.log("handleMessage====");
				console.log(data);
			},
			goRouter(ele) {
				if (ele.isJump == false) {
					uni.navigateTo({
						url: ele.path
					});
				}
			}
		}
	};
</script>

<style lang="scss">
	page {
		background: #fff;
		padding-top: 0rpx;
		box-sizing: border-box;
	}

	.bodyPage {
		padding-top: 100rpx;
		box-sizing: border-box;
	}

	.person_box {
		width: 100%;
		height: 236rpx;
		overflow: hidden;
		background-image: url(/static/images/usercenter.png);
		background-repeat: no-repeat;
		background-size: cover;
	}

	.link_box {
		height: 140rpx;
		border-bottom: 1px solid #ccc;
		display: flex;
		justify-content: center;
		align-items: center;

		>view {
			flex: 1;
			//line-height:140rpx;
			text-align: center;
			font-size: 24rpx;
			border-right: 1px solid #ccc;

			image {
				width: 50rpx;
				height: 50rpx;
				display: block;
				margin: 0 auto;
			}
		}

		// >view:nth-child(:last-child) {
		// 	border-right: none;
		// }
	}

	.userVIP_Item {
		width: 100%;
		height: auto;
		padding: 0 30rpx;
		box-sizing: border-box;

		view {
			height: 102rpx;
			line-height: 100rpx;
			border-bottom: 1px solid #ccc;
			padding: 0 10rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			font-size: 30rpx;
		}
	}
</style>
